using System;
using System.Collections.Generic;
using System.Text;
using NUnit.Framework;
using sbMembership.Library.Presenters;

namespace Tests.sbMembership.AddRole
{
    [TestFixture]
    public class AddRoleTest
    {
        private MockAddRoleView mockView;
        private AddRolePresenter presenter;
        private bool addRoleCompleteEventRaised;

        [TestFixtureSetUp]
        public void Setup()
        {
            mockView = new MockAddRoleView();
            presenter = new AddRolePresenter(mockView);
            mockView.AttachPresenter(presenter);
        }

        [Test]
        public void InitView()
        {
            presenter.InitView();
        }

        [Test]
        public void AddRole()
        {
            presenter.AddRoleCompleteEvent = new EventHandler(OnAddRoleCompleteEvent);
            presenter.AddRole(true);
            Assert.IsTrue(addRoleCompleteEventRaised);
        }

        void OnAddRoleCompleteEvent(object sender, EventArgs e)
        {
            addRoleCompleteEventRaised = true;
        }
    }
}
